package servlet.hrf;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.hrf.GoodsDAO;
import entity.Member;
import entity.Product;

/**
 * Servlet implementation class Product
 */
@WebServlet("/Product")
public class Product1 extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private GoodsDAO one = new GoodsDAO();
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		if(!(request.getSession().getAttribute("memberid")==null)){
			int id=Integer.parseInt(request.getSession().getAttribute("memberid").toString());
			List<Member> list1=one.selectmb(id);
			request.getSession().setAttribute("member", list1);
		}
		List<Product> list=one.select1();
		request.setAttribute("product",list);
		
		
		request.getRequestDispatcher("homePage.jsp").forward(request, response);
	}
	


}
